<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="StarOffice/5.2 (Linux)">
	<META NAME="CREATED" CONTENT="20020517;23103700">
	<META NAME="CHANGEDBY" CONTENT=" ">
	<META NAME="CHANGED" CONTENT="20021126;14003000">
</HEAD>
<BODY>
<H2 ALIGN=CENTER>Running up YAFFS using the MTD interface</H2>
<P>Here are the steps required to get YAFFS going with the
NANDemulation MTD that I have written.</P>
<P><FONT COLOR="#800000"><FONT SIZE=4 STYLE="font-size: 16pt"><I><U><B>Warning:
This is experimental stuff that plugs into the kernel. It has only
been lightly tested. Don't play with this on a box you are not
prepared to reboot.</B></U></I></FONT></FONT></P>
<P>There are a few things you need to do. This document assumes that
you're working from the 2.4.18 kernel code base.</P>
<H3>Preparing the kernel</H3>
<P>First off, you need to patch the mtdcore services.</P>
<OL>
	<LI><P>Replace the mtd files with the latest from the mtd cvs. This
	fixes problems where special NAND functions are not being copied
	through the partition handler. 
	</P>
	<LI><P>Build the kernel including the following configurations to
	support mtd.</P>
</OL>
<P STYLE="margin-left: 2cm">CONFIG_MTD=y Turn on MTD support</P>
<P STYLE="margin-left: 2cm">CONFIG_MTD_PARTITIONS=y Turn on partition
support</P>
<P STYLE="margin-left: 2cm">CONFIG_MTD_CHAR=y Need char drivers to
access the data from user space.</P>
<P STYLE="margin-left: 2cm">CONFIG_MTD_BLOCK=y Block driver interface
used only to find the device for mounting</P>
<P STYLE="margin-left: 2cm">may as well also set:</P>
<P STYLE="margin-left: 2cm">CONFIG_MTD_DEBUG=y</P>
<OL>
	<P>CONFIG_MTD_DEBUG_VERBOSE=3</P>
</OL>
<H3 ALIGN=LEFT>Setting up yaffs</H3>
<OL>
	<LI><P>Run the mtd utility MAKEDEV to make the /dev/mtdxxx entries.</P>
	<LI><P>Load up the NANDemul MTD by typing<BR><FONT FACE="Courier, monospace">#/sbin/insmod
	mtdemul/nandemul.o</FONT><BR>You should now be able to see the
	device in the mtd list by typing <BR>#<FONT FACE="Courier, monospace">cat
	/proc/mtd</FONT><BR>If all is well, the device will now be
	accessible as <FONT FACE="Courier, monospace">/dev/mtd0</FONT> and
	<FONT FACE="Courier, monospace">/dev/mtdblock0</FONT> (or whatever).</P>
	<LI><P>Now load up the yaffs filesystem module by
	typing<BR><FONT FACE="Courier, monospace">#/sbin/insmod
	mtdemul/yaffs.o<BR><FONT FACE="Times, serif">You should now be able
	to see the yaffs file systems by typing</FONT><BR>#cat
	/proc/filesystems</FONT></P>
	<LI><P><FONT FACE="Times, serif">Now create a mount point:<BR><FONT FACE="Courier, monospace">#mkdir
	/mnt/y</FONT></FONT></P>
	<LI><P><FONT FACE="Times, serif">Mount the file system:<BR><FONT FACE="Courier, monospace">#mount
	-t yaffs /dev/mtdblock0 /mnt/y</FONT></FONT></P>
	<LI><P><FONT FACE="Times, serif">Well if that all worked you have
	YAFFS running on the /mnt/y mount point using the NANDemul mtd.</FONT></P>
</OL>
<H3>What about real NAND?</H3>
<P><FONT FACE="Times, serif">You might want to try getting going on a
real NAND device.</FONT></P>
<P><FONT FACE="Times, serif">I have not yet done this, but the
NANDemul tests out the mtd interface so in theory it should work on
real NAND too.</FONT></P>
<P><FONT FACE="Times, serif">Note though that since YAFFS applies the
ECC and verify, it does not expect the NAND device to be applying ECC
or verification. </FONT>
</P>
<P><FONT FACE="Times, serif">You probably need to configure the NAND
with the following disabled:</FONT></P>
<P><FONT FACE="Times, serif">CONFIG_MTD_NAND_ECC</FONT></P>
<P><FONT FACE="Times, serif">CONFIG_MTD_NAND_VERIFY_WRITE</FONT></P>
<P><FONT FACE="Times, serif">Nick Banes has had YAFFS working on real
NAND, with a few issues. </FONT>
</P>
<P><BR><BR>
</P>
<P><FONT FACE="Times, serif">$Id: yaffs_on_mtd.html,v 1.3 2002/11/26 01:15:38 charles Exp $</FONT></P>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
</BODY>
</HTML>